<template>
  <el-scrollbar>
    <el-menu
        :default-active="this.$route.path"
        router
        class="el-menu-vertical-demo"
        :default-openeds="opened"
    >
      <el-sub-menu index="1" v-if="disabled">
        <template #title>
          <el-icon><avatar /></el-icon>
          <span>信息管理</span>
        </template>
        <el-menu-item index="1-1" route="/user/userInfo"><el-icon><user /></el-icon>修改信息</el-menu-item>
        <el-menu-item index="1-2" route="/user/userAddress"><el-icon><location /></el-icon>收货地址</el-menu-item>
      </el-sub-menu>
      <el-menu-item index="2" v-if="disabled" route="/book/shopCar"><el-icon><shopping-cart /></el-icon>购物车</el-menu-item>
      <el-sub-menu index="3" v-if="disabled">
        <template #title>
          <el-icon><list /></el-icon>
          <span>我的订单</span>
        </template>
        <el-menu-item index="3-1" :route="{ path: '/book/bookList' }"><el-icon><tickets /></el-icon>全部订单</el-menu-item>
        <el-menu-item index="3-2" :route="{ path: '/book/bookList', query: { state: '1' } }"><el-icon><document-add /></el-icon>待付款</el-menu-item>
        <el-menu-item index="3-3" :route="{ path: '/book/bookShippingList', query: { state: '2' } }"><el-icon><document-remove /></el-icon>待发货</el-menu-item>
        <el-menu-item index="3-4" :route="{ path: '/book/bookHarvest', query: { state: '3' } }"><el-icon><van /></el-icon>待收货</el-menu-item>
        <el-menu-item index="3-5" :route="{ path: '/book/bookFinish', query: { state: '4' } }"><el-icon><document-checked /></el-icon>已完成</el-menu-item>
      </el-sub-menu>
      <el-sub-menu index="4" v-if="!disabled">
        <template #title>
          <el-icon><shop /></el-icon>
          <span>商户中心</span>
        </template>
        <el-menu-item index="4-1" route="/user/merchantInfo"><el-icon><element-plus /></el-icon>更新店铺信息</el-menu-item>
        <el-menu-item index="4-2" route="/commodity/addCommodity"><el-icon><plus /></el-icon>上架新的商品</el-menu-item>
        <el-menu-item index="4-3" route="/commodity/manageCommodity"><el-icon><notebook /></el-icon>商品信息管理</el-menu-item>
        <el-menu-item index="4-4" route="/commodity/commodityShipment"><el-icon><van /></el-icon>订单发货</el-menu-item>
      </el-sub-menu>
      <el-menu-item index="5" route="/account/AccountRemoval"><el-icon><remove /></el-icon>账户注销</el-menu-item>
    </el-menu>
  </el-scrollbar>
</template>

<script>
export default {
  name: "UserAside",
  data() {
    return {
      opened: ['1','3','4'],
      disabled: true,
    }
  },
  mounted() {
    this.disabled = localStorage.getItem("identityCode") !== '2';
  }
}
</script>

<style scoped>

</style>